package com.punch.order.controller;


import com.punch.common.model.Result;
import com.punch.common.vo.order.TransferOrderVO;
import com.punch.order.service.TransferOrderService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * <p>
 * 转账信息 前端控制器
 * </p>
 *
 * @author wjj
 * @since 2020-09-26
 */
@RestController
@Api(hidden = true)
public class TransferOrderController {

    @Resource
    private TransferOrderService transferOrderService;


    /**
     * 获取转账信息
     *
     * @return TransferOrderVO
     */
    @GetMapping(value = "/order/transfer/{settlementId}", produces = "application/json; charset=utf-8")
    @ApiOperation(value = "获取转账信息", notes = "获取转账信息", produces = "application/json; charset=utf-8")
    public Result<TransferOrderVO> getTransfer(@PathVariable Long settlementId) {
        return Result.succeed(transferOrderService.getTransfer(settlementId));
    }


    /**
     * 新增结算转账信息
     *
     * @param transferOrderVO 转账信息
     * @return transferId
     */
    @PostMapping(value = "/order/transfer", produces = "application/json; charset=utf-8")
    @ApiOperation(value = "新增结算转账信息", notes = "新增结算转账信息", produces = "application/json; charset=utf-8")
    public Result<Long> saveTransfer(@Valid @RequestBody TransferOrderVO transferOrderVO) {
        return Result.succeed(transferOrderService.saveTransfer(transferOrderVO));
    }
}
